﻿@model LanDBom.Models.Sheji
@using LanDBom.Resources
@{
    ViewBag.Title = "SJINFlp";
    Layout = "~/Views/Shared/_Genertals.cshtml";
}

<fieldset class="boun-m" style="width:96%">
    <legend class="len-x">@Resource.String1273</legend>
    <div>
        <table class="table ">
            <tr>
                <td>@Resource.String1274</td>
                <td><input type="file" value="scdff" id="wenjian" accept="*.frx" /></td>
                <td>@Resource.String1275</td>
                <td><input type="file" value="ihjn" id="tupain" accept="" /></td>
            </tr>
            <tr>
                <td>@Resource.String1276</td>
                <td><input type="text" name="name" value="" id="Gons" /></td>
                <td>@Resource.String1277</td>
                <td>
                    <select id="DUIyin">
                        <option value="通用">@Resource.String1278</option>
                        <option value="专属">@Resource.String1279</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>@Resource.String1280</td>
                <td colspan="3"><input type="text" value="" id="DUiyin" /> </td>
            </tr>
        </table>
        <div>
            <input type="button" class="btn btn-light" id="tijao" value="@Resource.String1230" />
            @Html.ActionLink(Resource.String778, "SHjixs", new { Controller = "Technology", Action = "SHjixs" }, new { @class = "btn btn-light" })
        </div>
    </div>
</fieldset>

@section scripts{
    <script src="~/Scripts/jquery-3.4.1.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script>
        $(function () {
            $("#tijao").click(function () {
                var fileUpload = $('#wenjian')[0];
                console.log(fileUpload)
                if (fileUpload.files.length > 0) {
                    var formData = new FormData();
                    formData.append('file', fileUpload.files[0]);
                    console.log(formData)
                    $.ajax({
                        url: '/Admin/Shtuzhi',
                        type: 'POST',
                        data: formData,
                        processData: false,		//用于对data参数进行序列化处理 这里必须false
                        contentType: false,
                        success: function (fgggh) {
                            var wenjains = fgggh//文件地址
                            var fileUd = $('#tupain')[0];
                            var tuzhi = "";
                            if (fileUd.files.length > 0) {
                                var fordat = new FormData();
                                fordat.append('file', fileUd.files[0]);
                                $.ajax({
                                    url: '/Admin/Shtuzhi',
                                    type: 'POST',
                                    data: fordat,
                                    processData: false,		//用于对data参数进行序列化处理 这里必须false
                                    contentType: false,
                                    success: function (ksnjdlp) {
                                        tuzhi = ksnjdlp
                                    },
                                    error: function () {

                                    }
                                });
                            }
                            //图片地址
                            var sheji = {
                                SJ_Dizhi: wenjains,
                                SJ_tupian: tuzhi,
                                SJ_gs: $("#Gons").val(),
                                SJ_Zhua: $("#DUIyin").val(),
                                SJ_beizhu: $("#DUiyin").val()
                            }
                            console.log(sheji)
                            $.ajax({
                                url: '/Admin/SJINFlp',
                                type: 'POST',
                                data: { "fordat": sheji, "stanf": 1 },
                                success: function (ALdji) {
                                    alert(ALdji)
                                },
                                error: function () {

                                }
                            });
                        },
                        error: function (xhr) {
                            alert("系统错误" + xhr);
                        }
                    })
                } else {
                    alert('请选择要上传的文件！');
                }
            })
        })
    </script>
}

